package com.facotry.util;

/**
 * --- 代码敲烂 月薪过万 ---
 *
 * @author 崔瑜航
 * @date 2024/7/4
 * @desc
 */

public class R {
    private int code;
    private String msg;
    private Object data;

    public static R ok(int code,String msg){
        return new R(20000,"成功");
    }
    public static R ok(Object data){
        return new R(20000,"成功",data);
    }
    public static R ok(){
        return new R(20000,"成功");
    }
    public static R fail(){
        return new R(4000,"错误");
    }
    public static R fail(String msg){
        return new R(4000,"错误",msg);
    }
    public static R fail(int code,String msg){
        return new R(code,msg);
    }


    public R(int code, String msg) {
        this.code = code;
        this.msg = msg;

    }

    public R(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    @Override
    public String toString() {
        return "R{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }



    public R() {
    }
}
